<template>
  <div class="goodsitem" @click="goodsclick">
    <img :src="showimage" @load="imglode" />
    <div class="goodsinfo">
      <p>{{ goodsitme.title }}</p>
      <span class="price">{{ goodsitme.orgPrice }}</span>
      <span class="collect">{{ goodsitme.cfav }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "goodslistitme",
  props: {
    goodsitme: {
      typr: Object,
      default() {
        return {};
      },
    },
  },
  computed: {
    showimage() {
      return this.goodsitme.image || this.goodsitme.show.img;
    },
  },
  methods: {
    imglode() {
      this.$bus.$emit("itmeimage");
    },
    goodsclick() {
      // console.log("----");
      // console.log(this.goodsitme.iid);
      this.$router.push("/detail/" + this.goodsitme.iid);
    },
  },
};
</script>

<style scoped>
.goodsitem {
  padding-bottom: 40px;
  position: relative;

  width: 48%;
}

.goodsitem img {
  width: 100%;
  border-radius: 5px;
}

.goodsinfo {
  font-size: 12px;
  position: absolute;
  bottom: 5px;
  left: 0;
  right: 0;
  overflow: hidden;
  text-align: center;
}

.goodsinfo p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}

.goodsinfo .price {
  color: var(--color-high-text);
  margin-right: 15px;
}

.goodsinfo .collect {
  position: relative;
}

.goodsinfo .collect::before {
  content: "";
  position: absolute;
  left: -15px;
  top: -1px;
  width: 14px;
  height: 14px;
  background: url("~assets/img/common/collect.svg") 0 0/14px 14px;
}
</style>